//========================================================================
// *作者：海盗猫  主页：ilplay.com
// *脚本：HDMEditorStyle
// *描述：
// *?2021 MYJL . All rights reserved.
//* ======================================================================
using System.Diagnostics.Eventing.Reader;
using UnityEngine;
namespace HDMCode.FrameEditor
{
	public static class HDMEditorStyle
    {
        /// <summary>
        /// 绘制样式
        /// </summary>
        public static GUIStyle styleTile;
        public static GUIStyle styleContent;
        public static GUIStyle styleButton;
        public static GUIStyle styleTextField;
        public static GUIStyle styleSubtitle;
        public static GUIStyle styleTip;
        public static GUIStyle styleChildButton;
        public static GUIStyle styleCheckText;
        public static GUIStyle styleScrollbarA;
        public static GUIStyle styleScrollbarB;
        public static GUIStyle styleScrollbarC;
        public static GUIStyle styleYLine;
        public static GUIStyle styleTerrainArea;

        /// <summary>
        /// 主题颜色
        /// </summary>
        public static Color _supportedThemeColor = new Color(1,0.8f,0.5f,1);

        /// <summary>
        /// 文本颜色
        /// </summary>
        public static Color _supportedTextColor = Color.white;

        /// <summary>
        /// 创建一个样式
        /// </summary>
        /// <param name="lable"> 样式文本 </param>
        /// <param name="iconName"> 样式图标 </param>
        public static GUIContent CreatStyle(string lable,string iconName) 
        {
            GUIContent unlockFolder = new GUIContent($"    {lable}");
            unlockFolder.image = HDMEditorHelper.GetGUI(iconName, IconType.HDMIcon);
            return unlockFolder;
        }

        /// <summary>
        /// 初始化样式
        /// </summary>
        public static void InitStyle()
        {
            GUISkin skin = UnityEditor.AssetDatabase.LoadAssetAtPath<GUISkin>(HDMEditorDate.GUISkinAssetsPath);

            styleTile = skin.FindStyle("Tile");
            styleContent = skin.FindStyle("Content");
            styleButton = skin.FindStyle("Button");
            styleTextField = skin.FindStyle("TextField");
            styleSubtitle = skin.FindStyle("Subtitle");
            styleTip = skin.FindStyle("Tip");
            styleChildButton = skin.FindStyle("ChildButton");
            styleTerrainArea = skin.FindStyle("TerrainArea");
            styleCheckText = skin.FindStyle("CheckText");

            styleScrollbarA = skin.FindStyle("horizontalscrollbar");
            styleScrollbarB = skin.FindStyle("verticalscrollbar");
            styleScrollbarC = skin.FindStyle("verticalscrollbar");
            styleYLine = skin.FindStyle("Yline");

            styleContent.normal.textColor = _supportedTextColor;
            styleButton.normal.textColor = _supportedThemeColor;
            styleSubtitle.normal.textColor = _supportedThemeColor;
            styleChildButton.normal.textColor = _supportedThemeColor;
            styleCheckText.normal.textColor = _supportedTextColor;
        }
    }
}


